import 'package:flutter/material.dart';

/// If you are using flutter new sdk trying the built-in class [ValueNotifier] instead.
///
/// An simple wrapper which contains a generic type value to support notify.
class SimpleChangeNotifier<T> extends ChangeNotifier {
  SimpleChangeNotifier({T? initialValue}) {
    _value = initialValue;
  }

  T? _value;

  T? get value => _value;

  /// Updates [value] and triggers update.
  void change(T value) {
    _value = value;

    // Calls all the registered listeners.
    notifyListeners();
  }
}
